package com.xiaoshuidi.cloud.module.member.controller.app.programarticle;

import com.xiaoshuidi.cloud.framework.common.pojo.CommonResult;
import com.xiaoshuidi.cloud.framework.common.pojo.PageResult;
import com.xiaoshuidi.cloud.module.member.controller.admin.programarticle.vo.MemberArticlePageVO;
import com.xiaoshuidi.cloud.module.member.controller.admin.programarticle.vo.MemberArticleRespVO;
import com.xiaoshuidi.cloud.module.member.enums.ApiConstants;
import com.xiaoshuidi.cloud.module.member.service.programarticle.MemberArticleService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.annotation.security.PermitAll;
import javax.validation.Valid;

import static com.xiaoshuidi.cloud.framework.common.pojo.CommonResult.success;

@Tag(name = "租客APP - 文章")
@RestController
@RequestMapping(ApiConstants.NAME+"/article")
@Validated
public class AppMemberArticleController {
    @Resource
    private MemberArticleService memberArticleService;

    @PostMapping("/page")
    @Operation(summary = "分页查询文章列表")
    @PermitAll
    public CommonResult<PageResult<MemberArticleRespVO>> getPage(@Valid @RequestBody MemberArticlePageVO pageVo) {
        return success(memberArticleService.getPage(pageVo));
    }

}
